import 'package:flutter/material.dart';
import '../../layouts/main_layout.dart';
import '../../theme/theme.dart';
import 'home_page6.dart';
import '../../router/router.dart';

/// 主布局框架演示页面
class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return MainLayout(
      title: 'Flutter Miaoyi Web Admin',
      child: HomeContent(),
    );
  }
}

/// 首页内容区域
class HomeContent extends StatelessWidget {
  const HomeContent({super.key});

  @override
  Widget build(BuildContext context) {
    // 使用HTheme获取主题色
    final hTheme = HTheme.of(context);
    
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Icon(
            Icons.home_outlined,
            size: 80,
            color: hTheme.colors.primary,
          ),
          const SizedBox(height: 20),
          Text(
            '欢迎使用 Flutter Miaoyi Web Admin 框架',
            style: TextStyle(
              fontSize: 24,
              fontWeight: FontWeight.bold,
              color: hTheme.colors.primary,
            ),
          ),
          const SizedBox(height: 10),
          const Text(
            '一个基于 Flutter 的企业级 Web 后台管理框架',
            style: TextStyle(
              fontSize: 16,
              color: Colors.grey,
            ),
          ),
          const SizedBox(height: 30),
          ElevatedButton(
            onPressed: () {
              AppRouter.updateUrl('/home6');
            },
            style: ElevatedButton.styleFrom(
              backgroundColor: hTheme.colors.primary,
              foregroundColor: Colors.white,
            ),
            child: const Padding(
              padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
              child: Text('开始探索'),
            ),
          ),
        ],
      ),
    );
  }
}